<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>${applicationScope.ojName}</title>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/amazeui.min.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/amazeui.flat.min.css"/>
    <style>
        .main {
            width: 60%;
            margin: 0 auto;
        }

        .info {
            font-size: 14px;
            color: #777;
            background: #ffd;
            padding: 10px;
            margin-bottom: 20px;
        }
    </style>
</head>

<body>

<jsp:include page="/heard.html" flush="true"/>

<div class="main info">
    数据来源：http://contests.acmicpc.info/contests.json
    <br/> 本数据源力求支持所有国内ACMer的常用OJ，如果希望添加某个OJ或者发现某个OJ无法正常获取比赛信息，请联系doraemonok@163.com
</div>
<div class="main">
    <table class="am-table am-table-striped am-table-hover am-table-bordered">
        <thead>
        <tr>
            <th>OJ</th>
            <th>名称</th>
            <th>开始时间</th>
            <th>周</th>
            <th>访问前提</th>
        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
</div>

<jsp:include page="/foot.html" flush="true"/>

<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/js/amazeui.min.js"></script>
<script>
    $(function () {
        $.ajax({
            type: "get",
            async: false,
            url: "http://contests.acmicpc.info/contests.json",
            dataType: "jsonp",
            jsonp: "callbackparam", //服务端用于接收callback调用的function名的参数
            jsonpCallback: "success_jsonpCallback", //callback的function名称
            success: function (data) {
                $('tbody').append('<tr>')
                    .append('<td>' + data.oj + '</td>')
                    .append('<td><a href="' + data.link + '">' + data.name + '</a></td>')
                    .append('<td>' + data.start_time + '</td>')
                    .append('<td>' + data.week + '</td>')
                    .append('<td>' + data.access + '</td>')
                    .append('<tr>');
            },
            error: function () {
                alert('fail');
            }
        });
    });
</script>
</body>

</html>
<!--http://contests.acmicpc.info/contests.json-->